package com.jl.jlapp.wxapi;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.RadioButton;
import android.widget.TextView;

import butterknife.BindView;
import butterknife.ButterKnife;

import com.jl.jlapp.R;
import com.jl.jlapp.mvp.activity.BaseActivity;
import com.jl.jlapp.mvp.activity.OrderDetailActivity;
import com.jl.jlapp.utils.Tools;
import com.tencent.mm.opensdk.modelbase.BaseReq;
import com.tencent.mm.opensdk.modelbase.BaseResp;
import com.tencent.mm.opensdk.openapi.IWXAPI;
import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler;
import com.tencent.mm.opensdk.openapi.WXAPIFactory;

public class WXPayEntryActivity extends Activity implements IWXAPIEventHandler {
    private static final String TAG = "MicroMsg.SDKSample.WXPayEntryActivity";
    public static Integer orderId = Integer.valueOf(0);
    public static String orderNo = "";
    public static Integer resultCode = Integer.valueOf(1);
    private IWXAPI api;
    @BindView(R.id.rb_left)
    RadioButton returnHomePage;
    @BindView(R.id.rb_right)
    RadioButton seeOrder;
    @BindView(R.id.tv_result)
    TextView tvResult;
    @BindView(R.id.tv_succsess_num)
    TextView tvSuccessNum;

    public void onCreate(Bundle paramBundle) {
        super.onCreate(paramBundle);
        setContentView(R.layout.pay_result);
        ButterKnife.bind(this);
        this.api = WXAPIFactory.createWXAPI(this, "wx037454184aee70e9");
        this.api.handleIntent(getIntent(), this);
    }

    protected void onDestroy() {
        super.onDestroy();
        finish();
    }

    protected void onNewIntent(Intent paramIntent) {
        super.onNewIntent(paramIntent);
        setIntent(paramIntent);
        this.api.handleIntent(paramIntent, this);
    }

    public void onReq(BaseReq paramBaseReq) {
    }

    public void onResp(BaseResp paramBaseResp) {
        Log.d("aaaWXPayEntryActivity", "onPayFinish, errCode = " + paramBaseResp.errCode + " orderId:" + orderId);
        int i = paramBaseResp.errCode;
        if (i == 0) {
            Tools.finishAll();
            resultCode = Integer.valueOf(0);
            this.tvSuccessNum.setText("您的订单(订单号:" + orderNo + ")已支付成功并提交仓库备货");
            this.returnHomePage.setOnClickListener(new OnClickListener() {
                public void onClick(View paramAnonymousView) {
                    Intent intent = new Intent(WXPayEntryActivity.this, BaseActivity.class);
                    intent.putExtra("shouldReplaceFragment", 0);
                    WXPayEntryActivity.this.startActivity(intent);
                }
            });
            this.seeOrder.setOnClickListener(new OnClickListener() {
                public void onClick(View paramAnonymousView) {
                    Intent intent = new Intent(WXPayEntryActivity.this, OrderDetailActivity.class);
                    intent.putExtra("orderId", WXPayEntryActivity.orderId);
                    WXPayEntryActivity.this.startActivity(intent);
                }
            });
        }
        do {
            if (i == -1) {
                resultCode = Integer.valueOf(-1);
                finish();
            }
        } while (i != -2);
        resultCode = Integer.valueOf(-2);
        finish();
    }
}


/* Location:              /Users/davidzhang/Documents/decompileApk/jlfood-dex2jar.jar!/com/jl/jlapp/wxapi/WXPayEntryActivity.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */